package com.yanqu.road.entity.activity.jiuzhou;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@FieldTypeAnnotation(tableName = "t_u_jiu_zhou_user_base_data",desc = "九州棋局用户基础数据")
public class JiuZhouUserBaseData extends DataObject {
    @FieldTypeAnnotation(desc = "活动ID", select = true, update = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "玩家ID",select = true, update = true)
    private long userId;
    @FieldTypeAnnotation(desc = "是否报名")
    private int hasSignUp;
    //Map<轮次,MAP<赛区,胜者>>
    @FieldTypeAnnotation(desc = "竞猜数据")
    private Map<Integer,Map<Integer,Long>> guessMap;
    //Map<轮次,是否获取奖励>
    @FieldTypeAnnotation(desc = "是否获取竞猜奖励,0否1是")
    private Map<Integer,Integer> getGuessRewardMap;
    @FieldTypeAnnotation(desc = "上次膜拜冠军的时间")
    private long lastWorshipTime;
    @FieldTypeAnnotation(desc = "当前赛区")
    private int zoneType;
    @FieldTypeAnnotation(desc = "最后晋级的轮次")
    private int lastRoundId;
    @FieldTypeAnnotation(desc = "声援券领奖0点时间戳")
    private long supportRewardTime;

    public int getActivityId() {
        return activityId;
    }
    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public long getUserId() {
        return userId;
    }
    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setOp(DataStatus.Update);
        }
    }

    public int getHasSignUp() {
        return hasSignUp;
    }
    public void setHasSignUp(int hasSignUp) {
        if (this.hasSignUp != hasSignUp) {
            this.hasSignUp = hasSignUp;
            setOp(DataStatus.Update);
        }
    }

    public java.util.Map<java.lang.Integer, java.util.Map<java.lang.Integer, java.lang.Long>> getGuessMap() {
        return guessMap;
    }
    public void setGuessMap(java.util.Map<java.lang.Integer, java.util.Map<java.lang.Integer, java.lang.Long>> guessMap) {
        if (null == guessMap){
            return;
        }
        if (this.guessMap == null || !this.guessMap.equals(guessMap)) {
            this.guessMap = guessMap;
            setOp(DataStatus.Update);
        }
    }

    public java.util.Map<java.lang.Integer, java.lang.Integer> getGetGuessRewardMap() {
        return getGuessRewardMap;
    }
    public void setGetGuessRewardMap(java.util.Map<java.lang.Integer, java.lang.Integer> getGuessRewardMap) {
        if (null == getGuessRewardMap){
            return;
        }
        if (this.getGuessRewardMap == null || !this.getGuessRewardMap.equals(getGuessRewardMap)) {
            this.getGuessRewardMap = getGuessRewardMap;
            setOp(DataStatus.Update);
        }
    }

    public long getLastWorshipTime() {
        return lastWorshipTime;
    }
    public void setLastWorshipTime(long lastWorshipTime) {
        if (this.lastWorshipTime != lastWorshipTime) {
            this.lastWorshipTime = lastWorshipTime;
            setOp(DataStatus.Update);
        }
    }


    /**
     * 竞猜
     */
    public void guess(int roundId,Map<Integer,Long> guessMap){
        this.guessMap.put(roundId,guessMap);
        setUpdateOption();
    }


    /**
     *  获取竞猜奖励
     * @param round
     */
    public void getGuessReward(int round){
        getGuessRewardMap.put(round,1);
        setUpdateOption();
    }

    /**
     * 是否领取过该轮次竞猜奖励
     */
    public boolean hasGetGuessReward(int round){
        if (getGuessRewardMap == null){
            getGuessRewardMap = new ConcurrentHashMap<>();
            return false;
        }
        if (getGuessRewardMap.containsKey(round) && getGuessRewardMap.get(round) == 1){
            return true;
        }
        return false;
    }

    public int getZoneType() {
        return zoneType;
    }

    public void setZoneType(int zoneType) {
        if (this.zoneType != zoneType) {
            this.zoneType = zoneType;
            setOp(DataStatus.Update);
        }
    }

    public int getLastRoundId() {
        return lastRoundId;
    }

    public void setLastRoundId(int lastRoundId) {
        if (this.lastRoundId != lastRoundId) {
            this.lastRoundId = lastRoundId;
            setOp(DataStatus.Update);
        }
    }

    public long getSupportRewardTime() {
        return supportRewardTime;
    }

    public void setSupportRewardTime(long supportRewardTime) {
        if (this.supportRewardTime != supportRewardTime) {
            this.supportRewardTime = supportRewardTime;
            setOp(DataStatus.Update);
        }
    }
}
